package terra.network.packet.server;

import org.jboss.netty.buffer.ChannelBuffer;

import terra.network.packet.Packet;

public class StaticInfo extends Packet {

	public static final byte ITEM = 0, FLORA = 1,  LIGHT = 2; 
	public float x,y;
	public int id;
	public byte type;
	public int oId;
	
	public StaticInfo() {
	}

	@Override
	public ChannelBuffer toBuffer() {

		ChannelBuffer buf = getNewBuffer();
		buf.writeByte(getId());
		buf.writeInt(oId);	
		buf.writeFloat(x);
		buf.writeFloat(y);	
		buf.writeInt(id);
		buf.writeByte(type);		
		return buf;
	}

	@Override
	public Packet fromBuffer(ChannelBuffer buf) {
		oId = buf.readInt();
		x = buf.readFloat();
		y = buf.readFloat();
		id = buf.readInt();
		type = buf.readByte();
		return this;
	}

	@Override
	public int getLength() {
		return 18;
	}

	@Override
	public boolean isDynamicLength() {
		return false;
	}

	@Override
	public byte getId() {
		return 11;
	}
	
	@Override
	public byte getPriority() {
		return PRIOR_NORMAL;
	}

}
